/*
 * @lc app=leetcode.cn id=1897 lang=javascript
 *
 * [1897] 重新分配字符使所有字符串都相等
 */

// @lc code=start
/**
 * @param {string[]} words
 * @return {boolean}
 */
var makeEqual = function (words) {
  const map = {};
  const len = words.length;
  words.join('').split('').forEach(ch => {
    map[ch] = map[ch] ? map[ch] + 1 : 1;
  });
  return Object.entries(map).filter(([key, value]) => {
    return value % len !== 0;
  }).length === 0;
};
// @lc code=end
